// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sys

import (
	"context"
	"hotgo/api/admin/stockabnormalpool"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	StockAbnormalPool = cStockAbnormalPool{}
)

type cStockAbnormalPool struct{}

// List 查看异动股票池列表
func (c *cStockAbnormalPool) List(ctx context.Context, req *stockabnormalpool.ListReq) (res *stockabnormalpool.ListRes, err error) {
	list, totalCount, err := service.SysStockAbnormalPool().List(ctx, &req.StockAbnormalPoolListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.StockAbnormalPoolListModel{}
	}

	res = new(stockabnormalpool.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出异动股票池列表
func (c *cStockAbnormalPool) Export(ctx context.Context, req *stockabnormalpool.ExportReq) (res *stockabnormalpool.ExportRes, err error) {
	err = service.SysStockAbnormalPool().Export(ctx, &req.StockAbnormalPoolListInp)
	return
}

// Edit 更新异动股票池
func (c *cStockAbnormalPool) Edit(ctx context.Context, req *stockabnormalpool.EditReq) (res *stockabnormalpool.EditRes, err error) {
	err = service.SysStockAbnormalPool().Edit(ctx, &req.StockAbnormalPoolEditInp)
	return
}

// View 获取指定异动股票池信息
func (c *cStockAbnormalPool) View(ctx context.Context, req *stockabnormalpool.ViewReq) (res *stockabnormalpool.ViewRes, err error) {
	data, err := service.SysStockAbnormalPool().View(ctx, &req.StockAbnormalPoolViewInp)
	if err != nil {
		return
	}

	res = new(stockabnormalpool.ViewRes)
	res.StockAbnormalPoolViewModel = data
	return
}

// Delete 删除异动股票池
func (c *cStockAbnormalPool) Delete(ctx context.Context, req *stockabnormalpool.DeleteReq) (res *stockabnormalpool.DeleteRes, err error) {
	err = service.SysStockAbnormalPool().Delete(ctx, &req.StockAbnormalPoolDeleteInp)
	return
}
